
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>11.2.2 进阶 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="nginx.html" />
    
    
    <link rel="prev" href="docker_basic.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    理想未死
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    1. java基础
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" >
            
                <span>
            
                    
                    1.1 数据类型
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../java/basic/string.html">
            
                <a href="../java/basic/string.html">
            
                    
                    1.1.1 字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../java/basic/num.html">
            
                <a href="../java/basic/num.html">
            
                    
                    1.1.2 数字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../java/basic/date.html">
            
                <a href="../java/basic/date.html">
            
                    
                    1.1.3 日期
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" >
            
                <span>
            
                    
                    1.2 集合
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../java/basic/list.html">
            
                <a href="../java/basic/list.html">
            
                    
                    1.2.1 list
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../java/basic/map.html">
            
                <a href="../java/basic/map.html">
            
                    
                    1.2.2 map
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="../java/basic/arr.html">
            
                <a href="../java/basic/arr.html">
            
                    
                    1.2.3 数组
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../java/basic/guifan.html">
            
                <a href="../java/basic/guifan.html">
            
                    
                    1.3 编码规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    2. 版本控制
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../java/git.html">
            
                <a href="../java/git.html">
            
                    
                    2.1 git
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../java/gradle.html">
            
                <a href="../java/gradle.html">
            
                    
                    2.4 gradle
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    3. 常用技术
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../java/patzn/poi.md">
            
                <span>
            
                    
                    3.1 poi
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../java/poi.html">
            
                <a href="../java/poi.html">
            
                    
                    3.1.1 原生poi
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../java/poi.html">
            
                <a href="../java/poi.html">
            
                    
                    3.1.2 easypoi
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    4. 常用框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../java/example2.md">
            
                <span>
            
                    
                    4.1 springboot
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../java/patzn/mybatis.md">
            
                <span>
            
                    
                    4.2 mybatisPlus
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../java/ali.html">
            
                <a href="../java/ali.html">
            
                    
                    4.3 spring cloud alibaba
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    5. 中间件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../java/rocket.md">
            
                <span>
            
                    
                    5.1 rockermq
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" >
            
                <span>
            
                    
                    5.2 Arthas(线上诊断工具)
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../java/jvm.html">
            
                <a href="../java/jvm.html">
            
                    
                    6. jvm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../java/example2.md">
            
                <span>
            
                    
                    7. 设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../java/patzn/readme.md">
            
                <span>
            
                    
                    8. 工具类
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../java/patzn/upload.md">
            
                <span>
            
                    
                    8.1 上传&下载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../java/patzn/input.md">
            
                <span>
            
                    
                    8.2 导入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../java/patzn/debris.md">
            
                <span>
            
                    
                    8.3 其他
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    9. 前端
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../js/debris.html">
            
                <a href="../js/debris.html">
            
                    
                    9.1 碎片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../java/example2.md">
            
                <span>
            
                    
                    9.2 vue
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../java/example2.md">
            
                <span>
            
                    
                    9.3 react
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../java/example2.md">
            
                <span>
            
                    
                    9.4 node.js
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" >
            
                <span>
            
                    
                    10. 数据库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../sql/mysql.html">
            
                <a href="../sql/mysql.html">
            
                    
                    10.1 设计规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../sql/pgsql.html">
            
                <a href="../sql/pgsql.html">
            
                    
                    10.2 常用函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../sql/design.html">
            
                <a href="../sql/design.html">
            
                    
                    10.3 海量数据处理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" >
            
                <span>
            
                    
                    11. 运维
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="linux.html">
            
                <a href="linux.html">
            
                    
                    11.1 linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" >
            
                <span>
            
                    
                    11.2 docker
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.2.1" data-path="docker_basic.html">
            
                <a href="docker_basic.html">
            
                    
                    11.2.1 基础
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.12.2.2" data-path="docker_pro.html">
            
                <a href="docker_pro.html">
            
                    
                    11.2.2 进阶
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="nginx.html">
            
                <a href="nginx.html">
            
                    
                    11.3 nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="jenkins.html">
            
                <a href="jenkins.html">
            
                    
                    11.4 jenkins
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../mac/experience.html">
            
                <a href="../mac/experience.html">
            
                    
                    12. 操作系统
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >11.2.2 进阶</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="1&#x5BB9;&#x5668;&#x6570;&#x636E;&#x5377;">1.&#x5BB9;&#x5668;&#x6570;&#x636E;&#x5377;</h2>
<p>&#x5BB9;&#x5668;&#x7684;&#x6301;&#x4E45;&#x5316;&#x548C;&#x540C;&#x6B65;&#x64CD;&#x4F5C;&#xFF1B;&#x5BB9;&#x5668;&#x548C;&#x5BBF;&#x4E3B;&#x673A;&#x4E4B;&#x95F4;&#x6570;&#x636E;&#x5171;&#x4EAB;</p>
<pre><code>docker -it -v /home/ceshi:/home centos /bin/bash  &#x53CC;&#x5411;&#x7ED1;&#x5B9A;
</code></pre><p>a.&#x6D4B;&#x8BD5;&#xFF1A;&#x6301;&#x4E45;&#x5316;mysql</p>
<p><strong>&#x6CE8;&#x610F;</strong>
<img src="../picture/volume.png" alt="avatar"></p>
<p>&#x56E0;&#x4E3A;&#x662F;&#x5BBF;&#x4E3B;&#x673A;&#x6620;&#x5C04;&#x5BB9;&#x5668;&#xFF0C;&#x5148;&#x5C06;&#x8981;&#x6302;&#x8F7D;&#x7684;&#x6587;&#x4EF6;&#x4ECE;&#x6216;&#x6587;&#x4EF6;&#x5939;&#x4ECE;&#x5BB9;&#x5668;&#x4E2D;&#x62F7;&#x8D1D;&#x5230;&#x5BBF;&#x4E3B;&#x673A;&#xFF0C;&#x518D;&#x8FDB;&#x884C;&#x6302;&#x8F7D;</p>
<p>1.1 &#x6307;&#x5B9A;&#x8DEF;&#x5F84;&#x6302;&#x8F7D;</p>
<pre><code> docker run -d -p 3306:3306 -v /data/mysql/conf:/etc/mysql/conf.d -v /data/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql02 mysql
</code></pre><p>1.2 &#x5177;&#x540D;&#x6302;&#x8F7D; </p>
<pre><code>docker run -d -P --name nginx02 -v juming:/etc/nginx nginx
</code></pre><p>1.3 &#x533F;&#x540D;&#x6302;&#x8F7D;    </p>
<pre><code>docker run -d -P --name nginx03 -v /etc/nginx
</code></pre><pre><code>docker volume ls  //&#x67E5;&#x770B;&#x6240;&#x6709;&#x5377;&#x7684;&#x60C5;&#x51B5;

docker volume inspect juming //&#x67E5;&#x770B;&#x8FD9;&#x4E2A;&#x5377;

docker run -d -P --name nginx02 -v juming:/etc/nginx:ro nginx  //&#x53EA;&#x8BFB;&#x6743;&#x9650; &#x53EA;&#x80FD;&#x5728;&#x5BBF;&#x4E3B;&#x673A;&#x4FEE;&#x6539;&#x6587;&#x4EF6;

docker run -d -P --name nginx02 -v juming:/etc/nginx:rw nginx
</code></pre><p>&#x5377;&#x7684;&#x4F4D;&#x7F6E;
<img src="../picture/volume01.png" alt="avatar"></p>
<h2 id="2&#x6570;&#x636E;&#x5377;&#x5BB9;&#x5668;">2.&#x6570;&#x636E;&#x5377;&#x5BB9;&#x5668;</h2>
<p>&#x5B9E;&#x73B0;&#x5BB9;&#x5668;&#x4E4B;&#x95F4;&#x7684;&#x6570;&#x636E;&#x6302;&#x8F7D; &#x4E92;&#x4E3A;&#x4E3B;&#x4ECE;</p>
<pre><code> docker run -it --name docker01  centos_xt:1.0.0  /bin/bash    //&#x542F;&#x52A8;&#x4E00;&#x4E2A;&#x5BB9;&#x5668;

 docker run -it --name docker02  --volumes-from docker01 centos_xt:1.0.0  /bin/bash            //&#x542F;&#x52A8;&#x53E6;&#x4E00;&#x4E2A;&#x5BB9;&#x5668;&#xFF0C;&#x6570;&#x636E;&#x5377;&#x6302;&#x8F7D;&#x5728;&#x5BB9;&#x5668;01&#x7684;&#x6570;&#x636E;&#x5377;&#x4E0A;
</code></pre><h2 id="3dockerfile">3.Dockerfile</h2>
<p>&#x5C31;&#x662F;&#x7528;&#x6765;&#x6784;&#x5EFA;docker&#x955C;&#x50CF;&#x7684;&#x6784;&#x5EFA;&#x6587;&#x4EF6;&#xFF01;</p>
<pre><code>touch dockerfile //&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#xFF0C;&#x540D;&#x5B57;&#x6700;&#x597D;&#x662F;dockerfile

FROM centos
VOLUME [&quot;volume01&quot;,&quot;volume02&quot;]
CMD echo &quot;----end----&quot;
CMD /bin/bash

docker build -f dockerfile -t centos_xt .   //&#x522B;&#x62C9;&#x4E0B;&#x8FD9;&#x4E2A;.

docker inspect &#x5BB9;&#x5668;id
</code></pre><p>&#x533F;&#x540D;&#x6302;&#x8F7D;
<img src="../picture/volumes.png" alt="avatar"></p>
<p><strong>&#x6307;&#x4EE4;</strong></p>
<pre><code>FROM                 # &#x57FA;&#x7840;&#x955C;&#x50CF; &#x4E00;&#x5207;&#x4ECE;&#x8FD9;&#x91CC;&#x6784;&#x5EFA; centos
MAINTAINER        # &#x955C;&#x50CF;&#x7684;&#x4F5C;&#x8005;  &#x59D3;&#x540D;+&#x90AE;&#x7BB1;
RUN                 # &#x955C;&#x50CF;&#x6784;&#x5EFA;&#x7684;&#x65F6;&#x5019;&#x9700;&#x8981;&#x8FD0;&#x884C;&#x7684;&#x547D;&#x4EE4;
ADD                    # &#x6B65;&#x9AA4; &#x6DFB;&#x52A0;&#x5185;&#x5BB9; &#x5982; tomcat&#x955C;&#x50CF;
WORKDIR            # &#x955C;&#x50CF;&#x7684;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;
VOLUME             # &#x6302;&#x8F7D;&#x7684;&#x76EE;&#x5F55;
EXPOSE                # &#x4FDD;&#x7559;&#x7AEF;&#x53E3;&#x914D;&#x7F6E;
CMD                    # &#x6307;&#x5B9A;&#x5BB9;&#x5668;&#x542F;&#x52A8;&#x7684;&#x65F6;&#x5019;&#x8FD0;&#x884C;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x53EA;&#x6709;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x751F;&#x6548;&#xFF0C;&#x4F1A;&#x88AB;&#x4EE3;&#x66FF; 
ENTRYPOINT        # &#x6307;&#x5B9A;&#x5BB9;&#x5668;&#x542F;&#x52A8;&#x7684;&#x65F6;&#x5019;&#x8FD0;&#x884C;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x53EF;&#x4EE5;&#x8FFD;&#x52A0; 
ONBUILD            # &#x5F53;&#x6784;&#x5EFA;&#x4E00;&#x4E2A;&#x88AB;&#x7EE7;&#x627F;&#x7684;dockfile&#x65F6;&#xFF0C;&#x5C31;&#x4F1A;&#x8FD0;&#x884C;ONBUILD&#x7684;&#x6307;&#x4EE4;
COPY                # &#x76F8;&#x5F53;&#x4E8E; ADD&#xFF0C;&#x5C06;&#x6587;&#x4EF6;&#x62F7;&#x8D1D;&#x5230;&#x955C;&#x50CF;&#x4E2D;
ENV                    # &#x6784;&#x5EFA;&#x7684;&#x65F6;&#x5019;&#x8BBE;&#x7F6E;&#x73AF;&#x5883;&#x53D8;&#x91CF;
</code></pre><p>&#x81EA;&#x5DF1;&#x6253;&#x5305;&#x4E00;&#x4E2A;centos&#x955C;&#x50CF;&#xFF0C;&#x5B8C;&#x5584;&#x547D;&#x4EE4;</p>
<pre><code>FROM centos
MAINTAINER xtuao&lt;guangyan0011@gmail.com&gt;
ENV MYPATH /usr/local
WORKDIR $MYPATH
RUN yum -y install vim
RUN yum -y install net-tools
EXPOSE 80
CMD echo $MYPATH
CMD echo &quot;----end----&quot;
CMD /bin/bash
</code></pre><pre><code>docker history &#x955C;&#x50CF;id    //&#x67E5;&#x770B;&#x955C;&#x50CF;&#x7684;&#x6784;&#x5EFA;&#x8FC7;&#x7A0B;
</code></pre><p><strong>&#x901A;&#x8FC7;dockerfile&#x6784;&#x5EFA;&#x81EA;&#x5DF1;&#x7684;&#x955C;&#x50CF;</strong></p>
<pre><code>1.&#x5BFC;&#x51FA;&#x955C;&#x50CF;&#xFF1A;&#x5728;&#x6839;&#x76EE;&#x5F55;&#x4E0B;
docker save &lt;myimage&gt;:&lt;tag&gt; | gzip &gt; &lt;myimage&gt;_&lt;tag&gt;.tar.gz
2.&#x5BFC;&#x5165;&#x955C;&#x50CF;&#xFF1A;
gunzip -c &lt;myimage&gt;_&lt;tag&gt;.tar.gz | docker load


1.&#x5148;&#x51C6;&#x5907;jdk &#x548C; tomcat&#x7684;&#x538B;&#x7F29;&#x5305;&#xFF0C;&#x53BB;&#x5404;&#x81EA;&#x7684;&#x5B98;&#x7F51;&#x53BB;&#x4E0B;&#x8F7D;

2.&#x7F16;&#x5199;dockerfile
FROM centos
MAINTAINER xutao&lt;guangyan0011@gmail.cm&gt; 
ADD  jdk-8u251-linux-x64.tar.gz   /usr/local/
ADD  apache-tomcat-9.0.37.tar.gz    /usr/local/ 
RUN yum -y install vim 
ENV MYPATH /usr/local 
WORKDIR $MYPATH 
ENV JAVA_HOME /usr/local/jdk1.8.0_251
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
ENV CATALINA_HOME /usr/local/apache-tomcat-9.0.37
ENV CATALINA_BASH /usr/local/apache-tomcat-9.0.37
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin 
EXPOSE 8080 
CMD /usr/local/apache-tomcat-9.0.37/bin/startup.sh &amp;&amp; tail -F /usr/local/apache-tomcat-9.0.37/bin/logs/catalina.out


3.&#x6784;&#x5EFA;
docker build -f dockerfile -t mydocker .

4.&#x542F;&#x52A8;
docker run -d -p 3304:8080 --name mydocker02 -v /data/mydocker/test:/usr/local/apache-tomcat-9.0.37/webapps/test -v /data/mydocker/logs:/usr/local/apache-tomcat-9.0.37/logs mydocker

5.&#x5728;&#x5BBF;&#x4E3B;&#x673A;&#x7684;test&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x65B0;&#x5EFA;WEB-INF &#x6587;&#x4EF6;&#x5939;&#xFF0C;
&#x65B0;&#x5EFA;&#x6587;&#x4EF6;web.xml
&lt;web-app version=&quot;2.4&quot; 
    xmlns=&quot;http://java.sun.com/xml/ns/j2ee&quot; 
    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/j2ee 
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd&quot;&gt;
&lt;/web-app&gt;
&#x65B0;&#x5EFA;&#x6587;&#x4EF6;index.jsp
&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=utf-8&quot;
    pageEncoding=&quot;utf-8&quot;%&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
&lt;title&gt;&#x9996;&#x9875;&lt;/title&gt;
&lt;style&gt;
    *{
    padding:0;
    margin:0;
    font-family:&quot;&#x5FAE;&#x8F6F;&#x96C5;&#x9ED1;&quot;;
}
.header{
    height:72px;
    background:#458fce ;
}
.header .logo{
    color:#fff ;
    line-height:70px;
    font-size:30px;
    margin-left:20px;
    display:inline-block;
    text-align:center;

}
a {
    color: #fff ;
    text-decoration: none ;
}
.header .login{
    float:right;
    color:#fff ;
    line-height:72px;
    margin-right:2px;
    display:inline-block;
}
.banner{
    height:380px;
    overflow:hidden;
    background: #ddd;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div class=&quot;header&quot;&gt;
        &lt;div class=&quot;logo&quot;&gt;web&#x5B9E;&#x8DF5;&lt;/div&gt;
        &lt;div class =&quot;login&quot;&gt;
            &lt;a href =&quot;javascript:void(0)&quot;&gt;&#x767B;&#x5F55;&lt;/a&gt;
            &lt;span&gt;|&lt;/span&gt; 
            &lt;a href =&quot;javascript:void(0)&quot;&gt;&#x6545;&#x4E8B;&lt;/a&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre><p>&#x6548;&#x679C;&#x5982;&#x56FE; <a href="http://49.235.157.108:3304/test/" target="_blank">http://49.235.157.108:3304/test/</a>
<img src="../picture/mydocker.jpg" alt="avatar"></p>
<h2 id="4&#x53D1;&#x5E03;&#x955C;&#x50CF;">4.&#x53D1;&#x5E03;&#x955C;&#x50CF;</h2>
<p><strong>&#x53D1;&#x5E03;&#x955C;&#x50CF;&#x5230; dockerhub</strong></p>
<pre><code>docker login -u guangyan0011     //&#x767B;&#x9646;

docker tag 81409d1c24c6  guangyan0011/centos-xt:1.0.0   //&#x5C06;&#x955C;&#x50CF;&#x653E;&#x5230;guangyan0011&#x8D26;&#x6237;&#x4E0B;

docker push guangyan0011/centos-xt:1.0.0   //&#x63A8;&#x9001;
</code></pre><p><strong>&#x53D1;&#x5E03;&#x955C;&#x50CF;&#x5230;&#x963F;&#x91CC;&#x4E91;</strong></p>
<pre><code>&#x5728;&#x7F51;&#x7AD9;&#x4E0A;&#x521B;&#x5EFA; &#x547D;&#x540D;&#x7A7A;&#x95F4; &#x548C; &#x955C;&#x50CF;&#x4ED3;&#x5E93; 
&#x70B9;&#x51FB;&#x955C;&#x50CF;&#x4ED3;&#x5E93;&#xFF0C;&#x6709;&#x963F;&#x91CC;&#x4E91;&#x63D0;&#x793A;
$ sudo docker login --username=18854218403 registry.cn-hangzhou.aliyuncs.com
$ sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/guangyan01/docker01:[&#x955C;&#x50CF;&#x7248;&#x672C;&#x53F7;]
$ sudo docker push registry.cn-hangzhou.aliyuncs.com/guangyan01/docker01:[&#x955C;&#x50CF;&#x7248;&#x672C;&#x53F7;]
</code></pre><h2 id="5docker-&#x7F51;&#x7EDC;">5.docker &#x7F51;&#x7EDC;</h2>
<p>&#x901A;&#x8FC7; veth-pair &#x5B9E;&#x73B0;&#x7684;  &#x751F;&#x6210;&#x865A;&#x62DF;&#x7F51;&#x5361; &#x901A;&#x8FC7; docker etho0 &#x8F6C;&#x53D1;</p>
<p><strong>--link</strong></p>
<pre><code>docker run -d tomcat02 tomcat --link tomcat03

docker exec -it  tomcato2  ping tomcat03 // &#x53EF;&#x4EE5;ping&#x901A;
</code></pre><p><strong>&#x81EA;&#x5B9A;&#x4E49;&#x7F51;&#x7EDC;</strong></p>
<pre><code>docker network ls  // &#x67E5;&#x770B;&#x6240;&#x6709;&#x7684;docker&#x7F51;&#x7EDC;

docker network create --driver bridge --subnet 192.160.0.0/16 --gateway 192.168.0.1 mynet

docker run -d -p --name tomcat01 --net mynet  tomcat

docker run -d -p --name tomcat02 --net mynet  tomcat

// &#x8FD9;&#x6837;tomcat01&#x548C;tomcat02&#x662F;&#x53EF;&#x4EE5;&#x76F8;&#x4E92;ping&#x901A;&#x7684;
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="docker_basic.html" class="navigation navigation-prev " aria-label="Previous page: 11.2.1 基础">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="nginx.html" class="navigation navigation-next " aria-label="Next page: 11.3 nginx">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"11.2.2 进阶","level":"1.12.2.2","depth":3,"next":{"title":"11.3 nginx","level":"1.12.3","depth":2,"path":"linux/nginx.md","ref":"linux/nginx.md","articles":[]},"previous":{"title":"11.2.1 基础","level":"1.12.2.1","depth":3,"path":"linux/docker_basic.md","ref":"linux/docker_basic.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"linux/docker_pro.md","mtime":"2020-09-20T02:21:25.689Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-20T06:16:02.011Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

